package com.example.project;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;

public class HomeActivity extends Activity {
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.home);
		
		System.out.println("HOME");
	}
	
	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		getMenuInflater().inflate(R.menu.menu_main, menu);
		return true;
	}
	
	@Override
	public boolean onOptionsItemSelected(MenuItem item) {
		
		switch (item.getItemId())
        {
        case R.id.messaging:
        	Intent messagingActivity = new Intent(getBaseContext(), MessagingActivity.class);
        	messagingActivity.putExtra("address", getIntent().getStringExtra("address"));
        	messagingActivity.putExtra("port", getIntent().getStringExtra("port"));
        	messagingActivity.putExtra("token", getIntent().getStringExtra("token"));
        	
        	// for test
        	messagingActivity.putExtra("exam", "math");
        	
            startActivity(messagingActivity);
            return true;
 
        default:
            return super.onOptionsItemSelected(item);
        }
	}

}
